<?php
/**
 * Created by PhpStorm.
 * User: huutuit
 * Date: 2/3/2015
 * Time: 10:52 AM
 */

class Walker_Menu_Me extends Walker {
	// Tell Walker where to inherit it's parent and id values
	var $db_fields = array(
		'parent' => 'menu_item_parent',
		'id'     => 'db_id'
	);

	/**
	 * At the start of each element, output a <li> and <a> tag structure.
	 *
	 * Note: Menu objects include url and title properties, so we will use those.
	 */
	function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0 ) {
		$output .= sprintf("\n<li%s><a href='%s'><i class='fa %s'></i><br>%s</a></li>\n",
			($item->object_id == get_the_ID()) ? ' class="active"' : '',
			$item->url,
			$item->classes[0],
			$item->title
		);
	}
} 